color chooser: Fix a problem with show-editor=TRUE
authorMatthias Clasen <mclasen@redhat.com>
Wed, 26 Oct 2016 18:28:17 +0000 (14:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 26 Oct 2016 18:33:07 +0000 (14:33 -0400)
For some reason we end up allocating the colorplane widget
before it is realized, and then never initialize the surface.

Fix this by explicitly doing it on realize.

https://bugzilla.gnome.org/show_bug.cgi?id=773474

gtk/gtkcolorplane.c

index 0e374068127dc90e68e423ecdf8a259d8e4191ae..cfb9a5983bf2911b67a0af6d2411fb9f470067cd 100644 (file)
@@ -181,6 +181,14 @@ plane_size_allocate (GtkWidget     *widget,
   create_surface (GTK_COLOR_PLANE (widget));
 }
 
+static void
+plane_realize (GtkWidget *widget)
+{
+  GTK_WIDGET_CLASS (gtk_color_plane_parent_class)->realize (widget);
+
+  create_surface (GTK_COLOR_PLANE (widget));
+}
+
 static void
 set_cross_cursor (GtkWidget *widget,
                   gboolean   enabled)
@@ -491,6 +499,7 @@ gtk_color_plane_class_init (GtkColorPlaneClass *class)
 
   widget_class->draw = plane_draw;
   widget_class->size_allocate = plane_size_allocate;
+  widget_class->realize = plane_realize;
   widget_class->key_press_event = plane_key_press;
 
   g_object_class_install_property (object_class,